//
//  LaunchViewController.m
//  AnimationRecommend
//
//  Created by ljm on 2017/2/14.
//  Copyright © 2017年 ljm. All rights reserved.
//

#import "LaunchViewController.h"

@interface LaunchViewController ()

@end

@implementation LaunchViewController

//#pragma mark -- 触摸即消失
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {

    [self performSelector:@selector(dismissParentVC) withObject:nil afterDelay:0.5];
}

- (UIStatusBarStyle)preferredStatusBarStyle {
    
    return UIStatusBarStyleLightContent;
}

- (void)viewDidAppear:(BOOL)animated {
     [super viewDidAppear:animated];
     
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.f * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
         [self performSelector:@selector(dismissParentVC) withObject:nil afterDelay:1.f];
     });
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

     
      //网易云接口测试
//     [[NetworkTools shareTools] requestWithMethod:GET andURL:@"http://newsapi.sina.cn/?resource=feed&accessToken=&chwm=3023_0001&city=CHXX0016&connectionType=2&deviceId=99b912e123bf7d1baf5d5e95f1022e1bfb607884&deviceModel=apple-iphone5&from=6060193012&idfa=1B1E7134-BB9E-42C4-B808-24E3E4B049B9&idfv=49F2E40B-8B68-463B-834E-E64D53190AF9&imei=99b912e123bf7d1baf5d5e95f1022e1bfb607884&location=30.574711%2C104.064507&osVersion=10.2.1&resolution=640x1136&scheme_call=0&sfaId=99b912e123bf7d1baf5d5e95f1022e1bfb607884&ua=apple-iphone5__SinaNews__6.0.1__iphone__10.2.1&weiboSuid=&weiboUid=&wm=b207&rand=902&urlSign=7d86260d72&behavior=auto&channel=news_game&downTimes=1&lastTimestamp=&listCount=0&p=1&pullDirection=down&pullTimes=1&replacedFlag=0&s=20&upTimes=0" andParameters:nil andCallBack:^(id data, NSError *error) {
//          if (!error) {
//               NSLog(@"==========网易云请求数据============\n%@",data);
//          }else {
//               NSLog(@"==========网易云请求数据============ error =======================\n%@",error);
//          }
//     }];
     
    
    [self setupUI];
     
}

- (void)setupUI
{
    
     
     
    self.view.backgroundColor = [UIColor whiteColor];
    //    self.tips.text = @"我是启动界面";
    UIImageView *backImage = [[UIImageView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    [backImage sd_setImageWithURL:[NSURL URLWithString:LaunchViewImageUrlStr]];
    
    UILabel *label = [[UILabel alloc] init];
    //label.backgroundColor = [UIColor redColor];
    label.textColor = [UIColor whiteColor];
    label.textAlignment = NSTextAlignmentCenter;
    label.font = [UIFont fontWithName:ManYu_FontStr size:30];
    label.text = @"漫见";
    [label sizeToFit];
    label.center = CGPointMake(kwidth/2, kheight/2 + 90/AAdaptionWidth());
    [self.view addSubview:backImage];
    [self.view addSubview:label];
    
    UILabel *label_2 = [[UILabel alloc] init];
    
    label_2.text = @"- 二次元资讯·语录·壁纸·分享 -";
    label_2.textAlignment = NSTextAlignmentCenter;
    label_2.font = [UIFont fontWithName:ManYu_FontStr size:20];
     label_2.textColor = [UIColor whiteColor];
    [label_2 sizeToFit];
    label_2.center = CGPointMake(kwidth/2, kheight/2 + 65/AAdaptionWidth());
    [self.view addSubview:label_2];
   
    
}

#pragma mark -- action
- (void)dismissParentVC
{
     __weak typeof(self) weakSelf = self;
     [UIView animateWithDuration:1.f animations:^{
          [weakSelf.view removeFromSuperview];
          [weakSelf removeFromParentViewController];
     }];
     
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
